repo: Make locking precondition failures fatal
authorDan Nicholson <dbn@endlessos.org>
Thu, 6 May 2021 22:49:51 +0000 (16:49 -0600)
committerDan Nicholson <dbn@endlessos.org>
Sat, 5 Jun 2021 15:15:34 +0000 (09:15 -0600)
commit89f4ce2c1d3cacccee8129ac54bd60775dbbe5d2
tree62db698d9c25f86a6d050a1bcc8da61502faeb1a
parentccef9784d76c032b00ce5524fbfba39fa732b2fd
repo: Make locking precondition failures fatal

Use `g_error` and `g_assert*` rather than `g_return*` when checking the
locking preconditions so that failures result in the program
terminating. Since this code is protecting filesystem data, we'd rather
crash than delete or corrupt data unexpectedly.

`g_error` is used when the error is due to the caller requesting an
invalid transition like attempting to pop a lock type that hasn't been
taken. It also provides a semi-useful message about what happened.
src/libostree/ostree-repo.c